@import "./variables.scss";

@mixin font_color() {
  /*通过该函数设置字体颜色，后期方便统一管理；*/
  color: $fontColor-theme;
  [data-theme="theme1"] & {
    color: $fontColor-theme1;
  }
  [data-theme="theme2"] & {
    color: $fontColor-theme2;
  }
  [data-theme="theme3"] & {
    color: $fontColor-theme3;
  }
  [data-theme="theme4"] & {
    color: $fontColor-theme4;
  }
  [data-theme="theme5"] & {
    color: $fontColor-theme5;
  }
  [data-theme="theme6"] & {
    color: $fontColor-theme6;
  }
}
@mixin bg_color() {
  /*通过该函数设置主题颜色，后期方便统一管理；*/
  background-color: $bgColor-theme;
  [data-theme="theme1"] & {
    background-color: $bgColor-theme1;
  }
  [data-theme="theme2"] & {
    background-color: $bgColor-theme2;
  }
  [data-theme="theme3"] & {
    background-color: $bgColor-theme3;
  }
  [data-theme="theme4"] & {
    background-color: $bgColor-theme4;
  }
  [data-theme="theme5"] & {
    background-color: $bgColor-theme5;
  }
  [data-theme="theme6"] & {
    background-color: $bgColor-theme6;
  }
}

@mixin clearfix {
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

@mixin scrollBar {
  &::-webkit-scrollbar-track-piece {
    background: #d3dce6;
  }

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-thumb {
    background: #99a9bf;
    border-radius: 20px;
  }
}

@mixin relative {
  position: relative;
  width: 100%;
  height: 100%;
}

@mixin pct($pct) {
  width: #{$pct};
  position: relative;
  margin: 0 auto;
}

@mixin triangle($width, $height, $color, $direction) {
  $width: $width/2;
  $color-border-style: $height solid $color;
  $transparent-border-style: $width solid transparent;
  height: 0;
  width: 0;

  @if $direction==up {
    border-bottom: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  } @else if $direction==right {
    border-left: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  } @else if $direction==down {
    border-top: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  } @else if $direction==left {
    border-right: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  }
}

/*文本格式化，超出范围，显示省略号*/
@mixin text-overflow($width: 100%) {
  width: $width;
  display: inline-block; /** 对象作为伸缩盒子模型显示 **/
  -ms-text-overflow: ellipsis;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
  -webkit-line-clamp: 1; /** 显示的行数 **/
  overflow: hidden;
}

@mixin moreLine($width: 100%, $column: 2) {
  width: $width;
  word-break: break-all; /** word-break 属性规定自动换行的处理方法，允许在单词内换行 **/
  text-overflow: ellipsis; /** 文字超出显示省略号 **/
  display: inline-block; /** 对象作为伸缩盒子模型显示 **/
  -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
  -webkit-line-clamp: $column; /** 显示的行数 **/
  overflow: hidden; /** 隐藏超出的内容 **/
}
